﻿<?php 
    session_start();
    class HomeController{
        public function handleRequest(){
            $api = new api();
            if(!((isset($_SESSION['bg_login']['bg_username']) && isset($_SESSION['bg_login']['bg_level']) && $_SESSION['bg_login']['bg_level'] == 1)
                 || (isset($_COOKIE['bg_username'])&& isset($_COOKIE['bg_level']) && $_COOKIE['bg_level'] == 1 ))){
                 $getUrl = $api->curPageURL();
                 /*if(!empty($getUrl)){
                     header("Location:".BASE_URL_ADMIN."?com=login&action=".$getUrl);
                 }else{
                     header("Location:".BASE_URL_ADMIN."?com=login");
                 }*/
                 header("Location:".BASE_URL_ADMIN."?com=login");
                exit();
            }
			include ROOT_ADMIN.'/views/home/home.php';
		}
	}
?>